' Script for measuring H-reflex/M-wave responses. You should first load your configuration, ' which needs to contain an EMG channel and an event+ channel to detect stimulus onset. ' Once the config is loaded, modify the channel numbers below if needed. ' Last edited: May 2018, Neil Cronin, neil.j.cronin@jyu.fi ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Tell Spike which channels hold your stimulus and EMG data ' NOTE: Give the channel numbers, NOT the port numbers var chEMG% := 3; var chTRIG% := 6; ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' YOU SHOULD NOT NEED TO MODIFY ANYTHING BELOW THIS POINT. ONLY DO SO IF YOU KNOW WHAT YOU ARE DOING! ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Create and position the main sampling window FileNew(0); var dataView%; dataView% := View(); WindowTitle$("Sampling window"); Window(0, 0, 50, 100); WindowVisible(1); ' Setup the window showing each new stimulus (top right) var stimView%; WindowDuplicate(); Window(50,0,100,50); 'Grid(3); ' Turn y grid on stimView% := View(); WindowTitle$("H/M latest response"); ChanHide(-1); ChanShow(chEMG%); ChanShow(chTRIG%); WindowVisible(1); CursorSet(0); HCursorDelete(-1); ViewTrigger(chTRIG%,0,0,1,2,0,1,1,0,0); 'Enable view trigger. CursorDelete(-1); CursorSet(3); CursorActive(0, 14, chTRIG%, 0, "", "", 1); ' Position cursor 0 at the stimulus CursorActive(1,16, 0, "Cursor(0)+.005"); ' Position cursors 1-3 accordingly CursorActive(2,16, 0, "Cursor(0)+.025"); CursorActive(3,16, 0, "Cursor(0)+.050"); XRange(Cursor(0)+0.002, Cursor(0)+0.065); ' Setup a window (bottom right) where the H/M curve is plotted var xyPlot%; xyPlot% := MeasureToXY(14,chTRIG%,0,1); MeasureX(102, chEMG%, "Cursor(0)", 0); MeasureY(10, chEMG%, "Cursor(1)", "Cursor(2)", 0); 'M-wave peak-to-peak (change 10 to 1 if you want area) MeasureChan(1,"M-wave",0); MeasureX(102,chEMG%,"Cursor(0)",0); MeasureY(10,chEMG%,"Cursor(2)","Cursor(3)",0); 'H-ref peak-to-peak (change 10 to 1 if you want area) MeasureChan(0,"H-ref",0); ProcessTriggered(1.5,0.5,chTRIG%,0,1); Window(50,50,100,100); WindowVisible(1); WindowTitle$("H/M curve"); XYDrawMode(1,1,1); 'Point draw mode XYDrawMode(2,3,1); XYJoin(1,1); 'Set XY join mode XYJoin(2,1); XYColour(1,16); 'Set XY channel colour XYColour(2,1);